<?php
namespace App\Api\Models;

use Illuminate\Database\Eloquent\Model;

class ShoppingCard extends Model
{
    protected $table = 'ShoppingCards';

    public function goodsSku()
    {
        return $this->hasMany('cmc_goods_sku','skus_id','sku_id');
    }

    public static function getCardCreate($data)
    {
        return self::create($data);
    }

    public static function getCardList($goods_id,$allow_field)
    {
        return self::with('goodsSku')
                   ->where('goods_id',$goods_id)
                   ->select($allow_field)
                   ->get()
                   ->toArray();
    }
}